/**
 * Created by Administrator on 2017-07-25.
 */
var process_record = new Object();

process_record.init = function(basePath, page){
    process_record.basePath = basePath;
    process_record.page = page;
    // 个人成绩列表
    process_record.score_list();
}

/*培训练习项目课程信息列表*/
process_record.score_list = function() {
    var params = {
        'projectId':$("#projectId").val(),
        'userId':$("#userId").val()
    };
    $.ajax({
        url: appPath + "/student/ProjectOff/score_list",
        data: params,
        async: false,
        type: "post",
        dataType:"json",
        success:function(data){
            var result = data.result;
            var inner = "";
            if(null != result){
                inner += "<tr>";
                inner += "<td>1</td>";
                inner += "<td>"+ result['rank'] +"</td>";
                inner += "<td>"+result['score']+"</td>";
                if(result['isPassed'] == '1'){
                    inner += "<td><span class=\"text-gray\">合格</span></td>";
                }else{
                    inner += "<td><span class=\"text-red\">不合格</span></td>";
                }
                inner += "</tr>";
            }

            if(!inner){
                var length = $("#score_table").parent().find("th").length;
                inner = process_record.noList(length);
            }

            $("#score_table").empty().html(inner);
        }
    })

}


process_record.noList = function (length) {
    var inner = "";
    inner += "<tr>";
    inner += '<td colspan=\'' + length + '\' class=\"table_empty\"><img src=\'' + empty_img_src + '\'></img></td>'
    inner += "</tr>";
    return inner;
};
